import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { join } from 'path';
import { AppModule } from './app.module';
import * as session from 'express-session';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  app.useStaticAssets(join('public')); // 引入静态资源 ./public
  app.setBaseViewsDir(join('views')); // 引入模板引擎
  app.setViewEngine('ejs');
  app.use(
    session({
      secret: 'keyboard cat',
      cookie: { maxAge: 1000 * 60 },
      rolling: true,
    }),
  );

  await app.listen(3002);
}
bootstrap();
